package com.chezai.client.global;

import android.location.Location;
import android.location.LocationManager;

import com.chezai.client.bean.LatLng;
import com.chezai.client.utils.DateUtil;
import com.orhanobut.logger.Logger;

/**
 * Created by likunyang on 2018/1/13.
 */

public class Test {
    public static boolean start;
    static Location l1;
    static long current = System.currentTimeMillis();

    static {
        l1 = new Location(LocationManager.GPS_PROVIDER);
    }




    public static String locationToStr(Location l) {
        StringBuilder s = new StringBuilder();
        s.append("Location[");
        s.append(l.getProvider());
        s.append(String.format(" %.6f,%.6f", l.getLatitude(), l.getLongitude()));
        s.append(String.format(" hAcc=%.0f", l.getAccuracy()));
        s.append(" speed=" + l.getSpeed());
        s.append(" time=" + DateUtil.timestampStr(l.getTime(), DateUtil.sf7));
        s.append(']');
        return s.toString();
    }

    public static void testFence(int count) {
        int tag = count % 5;
        double lat = 39.453268;
        double lng = 116.363656;
        switch (tag) {
            case 0://围栏内
                lat = 39.951938;
                lng = 116.364222;
                break;
            case 1://围栏外
                lat = 39.953384;
                lng = 116.363436;
                break;
            case 2://围栏外
                lat = 39.953369;
                lng = 116.366459;
                break;
            case 3://围栏内
                lat = 39.95218;
                lng = 116.363962;
                break;
            case 4://围栏外
                lat = 39.952961;
                lng = 116.36831;
                break;
        }
        boolean isIn = PolygonManager.getInstance().latLngInPolygon(new LatLng(lng, lat));
        Logger.t("SpeechUtils").d(tag + " isIn = " + isIn);

    }




}
